package com.auxide.util;

import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;

public class Preferences {

	private static SharedPreferences mPrefs;
	private static SharedPreferences.Editor mEditor;
	
	public static final String LAST_IP_KEY = "lastIPConnection";
	public static final String LAST_IP_DEFAULT = "";
	
	public static final String LAST_NAME_KEY = "lastUserName";
	public static final String LAST_NAME_DEFAULT = "Anonymous";
	
	
	public static void setLastName(String name){
		mEditor.putString(LAST_NAME_KEY, name);
		mEditor.commit();
	}
	
	public static String getLastName(){
		return mPrefs.getString(LAST_NAME_KEY, LAST_NAME_DEFAULT);
	}
	
	public static void setLastIP(String ip){
		mEditor.putString(LAST_IP_KEY, ip);
		mEditor.commit();
	}
	
	public static String getLastIP(){
		return mPrefs.getString(LAST_IP_KEY, LAST_IP_DEFAULT);
	}
	
	public static void setUpPrefs(Context context){  
		mPrefs = PreferenceManager.getDefaultSharedPreferences(context);
		mEditor = mPrefs.edit();
		
		mEditor.commit();
	}
}
